#!/usr/bin/python3
# -*- coding:utf-8 -*-
""""
@Author: 李吉凯
@Email: lijk34925@hundsun.com
@Time: 2022/8/8 9:21
@File: check.py
"""
from qturboframe.lib.webdriver import SeleniumError

from BladeFerm.Lib.Common import logger
from BladeFerm.hui_app.hui_lib.check import CheckSingle as BladeCheckSingle


class CheckSingle(BladeCheckSingle):

    def get_cur_status(self):
        '''
        判断check控件是否是选中状态
        :return:
        '''
        class_content = self._element.get_attribute('class')
        class_list = class_content.split(' ')
        logger.debug(f'控件的属性：{class_list}')
        if self.check_class_flag not in class_list:
            raise SeleniumError(f'{self.locator_by}:{self.locator}定位错误，属性没有{self.check_class_flag}')
        if self.check_class_status in class_list:
            return True
        else:
            return False
